<form>
{% for question in question_list %}
    {{ question.qnum }}. {{question.qtext}}
    {% if question.required %}
        <span style='color: red;'>*</span>
    {% endif %}
    <br>
    {% if question.qtype == "radio" %}
        {% for option in question.options %}
            {% if option.id in question.answers %} 
                <input type="radio" name="{{ question.qid }}" id="{{ option.id }}" value="{{ option.id }}" checked>
            {% else %}
                <input type="radio" name="{{ question.qid }}" id="{{ option.id }}" value="{{ option.id }}">
            {% endif %}
            <label for="{{ option.id }}">{{ option.text }}</label>
            <br>
        {% endfor %}
    {% elif question.qtype == "checkbox" %}
        {% for option in question.options %}
            {% if option.id in question.answers %} 
                <input type="checkbox" name="{{ question.qid }}" id="{{ option.id }}" value="{{ option.id }}" checked>
                <label for="{{ option.id }}">{{ option.text }}</label>
                <br>
            {% else %}
                <input type="checkbox" name="{{ question.qid }}" id="{{ option.id }}" value="{{ option.id }}">
                <label for="{{ option.id }}">{{ option.text }}</label>
                <br>
            {% endif %}
        {% endfor %}
    {% else %}
        <input type="text" name="{{ question.qid }}" id="{{ option.id }}" value="{{ question.answers.0 }}">
    {% endif %}
    <br>
{% endfor %}
</form>